package com.itcast.flink.screen.database.bo;

import com.itcast.flink.screen.database.pojo.OrderAddress;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.persistence.Transient;

/**
 * <p>Description: </p>
 * @date  
 * @author   
 * @version 1.0
 * @name   
 * <p>Copyright:Copyright(c)2020</p>
 */
@Data
public class JoinOrderAddress {

    /**
     * 唯一主键标识
     */
    private Long id;

    public static JoinOrderAddress build(Order order, OrderAddress address) {
        JoinOrderAddress joinOrderAddress = new JoinOrderAddress();
        BeanUtils.copyProperties(order, joinOrderAddress);
        joinOrderAddress.setProvince(address.getProvince());
        joinOrderAddress.setCity(address.getCity());
        return joinOrderAddress;
    }

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 商品ID
     */
    private Long goodsId;

    /**
     * 商品名称
     */
    private String goodsName;

    /**
     * 成交金额
     */
    private Long execPrice;

    /**
     * 成交数量
     */
    private Integer execVolume;

    /**
     * 成交时间
     */
    private Long execTime;

    /**
     * 总成交金额
     */
    @Transient
    private Long totalAmount;

    /**
     * 省份
     */
    private String province;

    /**
     * 城市
     */
    private String city;
}
